package com.wk.demo;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wukai
 * @date 2023/6/7 16:22
 */
public class Money {
    public static void main(String[] args) {
        double m = 31423.567;
        // 0 要补齐长度 # 不需要补齐长度
        System.out.println(new DecimalFormat(",000.0000").format(m));
        System.out.println(new DecimalFormat(",###.####").format(m));

        System.out.println(Integer.toBinaryString(8));
        // 10进制转8进制
        System.out.println(Integer.toOctalString(9));
        // 10进制转16进制
        System.out.println(Integer.toHexString(23));

        System.out.println(Integer.toString(10,16));

        // 数字中间可以加下滑线，方便人，分段
        long bigNum = 123_123_123;
        System.out.println(bigNum);

        Long bigNum2 = 123_123_123L;
        System.out.println(bigNum2);

        List<String> list = new ArrayList<>();
        list.add("03sss");
        list.add("02aaa");
        list.add("32kkk");
        list.removeIf(s->s.contains("3"));
        System.out.println(list);

        Map<String,String> map = new HashMap<>();
        map.put("a","a1111");
        map.put("b","b222");
        map.put("c","c333");
        map.entrySet().removeIf(e->e.getKey().equals("b"));
        System.out.println(map);

        try {
            Runtime.getRuntime().exec("cmd");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
